package com.hoyue.classroom.controller;

import com.hoyue.classroom.service.MemberService;
import com.hoyue.common.utils.Base64Utils;
import com.hoyue.system.bean.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author 小方
 * @version 1.0
 * Create by 2019/8/29 23:49
 */
@Controller
@RequestMapping("/grade")
public class GradeController {
    private String prefix = "grade";
    @Autowired
    MemberService memberService;

    @GetMapping("/list/{id}")
    public String List(Model model, @PathVariable(value="id") Integer id) {
        List<User> students = memberService.ListMember(id);
        model.addAttribute("students", students);
        model.addAttribute("CourseCode", Base64Utils.encode(id));
        return prefix + "/grade";
    }
}
